<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class User extends Model
{
    use SoftDeletes;
    const UPDATED_AT = null;
    const CREATED_AT = null;
    protected $hidden = ['create_time', 'deleted_at', 'password'];

    /**
     * 用户和权限的多对多
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function belongsToRole(){
        return $this->belongsToMany(Role::class, 'user_roles', 'user_id', 'role_id');
    }
}
